home *** CD-ROM | disk | FTP | other *** search
/ Programming Languages Suite / ProgramD2.iso / Borland / Borland C++ V5.02 / CLASSSRC.PAK / GEOMETRP.CPP < prev    next >
C/C++ Source or Header  |  1997-05-06  |  3KB  |  141 lines

  1. //----------------------------------------------------------------------------
  2. // Borland WinSys Library
  3. // Copyright (c) 1993, 1997 by Borland International, All Rights Reserved
  4. //
  5. //$Revision:   5.5  $
  6. //
  7. // Implementation of persistent streaming for window system structure and type
  8. // encapsulation
  9. //----------------------------------------------------------------------------
  10. #include <winsys/pch.h>
  11. #include <winsys/geometry.h>
  12.  
  13. #if defined(BI_NAMESPACE)
  14. namespace ClassLib {
  15. #endif
  16.  
  17. //----------------------------------------------------------------------------
  18. // TRect streaming
  19. //
  20.  
  21. //
  22. // Extracts the rectangle from the persistent stream.
  23. //
  24. ipstream& _WSYSFUNC
  25. operator >>(ipstream& is, TRect& r)
  26. {
  27.   return is >> r.left >> r.top >> r.right >> r.bottom;
  28. }
  29.  
  30. //
  31. // Inserts the rectangle into a persistent stream.
  32. //
  33. opstream& _WSYSFUNC
  34. operator <<(opstream& os, const TRect& r)
  35. {
  36.   return os << r.left << r.top << r.right << r.bottom;
  37. }
  38.  
  39. //----------------------------------------------------------------------------
  40. // TPointL streaming
  41. //
  42.  
  43. //
  44. // Extract the point from the input persistent stream.
  45. //
  46. ipstream& _WSYSFUNC
  47. operator >>(ipstream& is, TPointL& p)
  48. {
  49.   long x;
  50.   is >> x;
  51.   p.x = x;
  52.  
  53.   long y;
  54.   is >> y;
  55.   p.y = y;
  56.  
  57.   return is;
  58. }
  59.  
  60. //
  61. // Insert the point into an output persistent stream.
  62. //
  63. opstream& _WSYSFUNC
  64. operator <<(opstream& os, const TPointL& p)
  65. {
  66.   return os << p.x << p.y;
  67. }
  68.  
  69. //----------------------------------------------------------------------------
  70. // TPointF streaming
  71. //
  72.  
  73. //
  74. // Extract a point from the persistent input stream.
  75. //
  76. ipstream& _WSYSFUNC
  77. operator >>(ipstream& is, TPointF& p)
  78. {
  79.   return is >> p.x >> p.y;
  80. }
  81.  
  82. //
  83. // Insert a point into the output persistent stream.
  84. //
  85. opstream& _WSYSFUNC
  86. operator <<(opstream& os, const TPointF& p)
  87. {
  88.   return os << p.x << p.y;
  89. }
  90.  
  91. //----------------------------------------------------------------------------
  92. // TPoint streaming
  93. //
  94.  
  95. //
  96. // Extract a point from a persistent input stream.
  97. //
  98. ipstream& _WSYSFUNC
  99. operator >>(ipstream& is, TPoint& p)
  100. {
  101.   return is >> p.x >> p.y;
  102. }
  103.  
  104. //
  105. // Insert a point into a persistent output stream.
  106. //
  107. opstream& _WSYSFUNC
  108. operator <<(opstream& os, const TPoint& p)
  109. {
  110.   return os << p.x << p.y;
  111. }
  112.  
  113. //----------------------------------------------------------------------------
  114. // TSize streaming
  115. //
  116.  
  117. //
  118. // Extract a size from a persistent input stream.
  119. //
  120. ipstream& _WSYSFUNC
  121. operator >>(ipstream& is, TSize& s)
  122. {
  123.   return is >> s.cx >> s.cy;
  124. }
  125.  
  126. //
  127. // Insert a size into a persistent output stream.
  128. //
  129. opstream& _WSYSFUNC
  130. operator <<(opstream& os, const TSize& s)
  131. {
  132.   return os << s.cx << s.cy;
  133. }
  134.  
  135. #if defined(BI_NAMESPACE)
  136. } // namespace ClassLib
  137. #endif
  138.  
  139.  
  140.  
  141.